package org.itstack.command;

public class SmartHomeDemo {
    public static void main(String[] args) {
        //创建设备
        Light light = new Light();
        AirConditioner ac = new AirConditioner();
        //创建遥控器
        RemoteControl remoteControl = new RemoteControl();
        //创建命令
        Command lightOnCommand = new LightOnCommand(light);
        Command acOnCommand = new TemperatureCommand(ac, 26);
        
        //创建宏命令
        MacroCommand homeScene = new MacroCommand();
        homeScene.addCommand(lightOnCommand);
        homeScene.addCommand(acOnCommand);
        

        System.out.println("执行回家场景");
        remoteControl.executeCommand(homeScene);

    
        System.out.println("撤销回家场景");
        remoteControl.undo();

        System.out.println("单独控制设备");
        remoteControl.executeCommand(acOnCommand);
        
        
    }

}
